#include "Camera.h"

	Camera::Camera(int x, int y, int w, int h, int lvlwidth, int lvlheight)
	{
		CameraRect.x = x;
		CameraRect.y = y;
		CameraRect.w = w;
		CameraRect.h = h;
		lvlw = lvlwidth;
		lvlh = lvlheight;
	}

	void Camera::Update(int x, int y)
	{
		CameraRect.x = x - ((CameraRect.w)/2);
		CameraRect.y = y - ((CameraRect.h)/2);

		//Out of Bounds Adjustments
		if(CameraRect.x < 0)
			CameraRect.x = 0;
		if(CameraRect.x + CameraRect.w > lvlw)
			CameraRect.x = lvlw - CameraRect.w;

		if(CameraRect.y < 0)
			CameraRect.y = 0;
		if(CameraRect.y + CameraRect.h > lvlh)
			CameraRect.y = lvlh - CameraRect.h;
	}